import '@/styles/index.scss';
import 'uno.css';

import { createApp } from 'vue';
import { setupRouter } from '@/router/index.js';
import { setupStore } from '@/store/index.js';
//小项目使用此方法代替状态管理器
// import { setupAppProvide } from '@/provide/index.js'
import { setAppConfig } from '@/app-config/index.js';
import { setupDirectives } from '@/directives/index.js';
import { setupVxeTable } from '@/plugin/vxe-table/index.js';
import { setupComponents } from '@/components/index.js';
import { setupNaiveUi } from '@/utils/naiveUi.js';
import 'virtual:svg-icons-register';
import '@/styles/vxe-var.scss';
import App from './App.vue';

function setupApp(AppComponent) {
  const app = createApp(AppComponent);
  /*
   * 注意事项!
   * setupStore 与 setupAppProvide 要放在顶部
   * 同时存在时 setupStore 优先
   * */
  setupStore(app); // 挂载Pinia
  // setupAppProvide(app) //挂载全局注入
  setupRouter(app); //挂载Vue-Router
  setupDirectives(app); //挂载全局自定义指令
  setAppConfig(app); //挂载全局配置
  setupVxeTable(app); //挂载VxeTable
  setupComponents(app); // 挂载全组件
  setupNaiveUi(); // 初始化UI组件
  app.mount('#app');
}

setupApp(App);
